package calculator.controller;/*
 * @author     ：zhangbo
 * @date       ：Created in 2021/5/22 12:36
 * @description：负责处理用户单击平方根按钮触发的ActionEvent事件。
 * @modified By：zhangbo
 * @version:     $
 */

import calculator.model.Sqrt;
import calculator.view.CalculatorWindows;

import java.awt.event.ActionEvent;

public class HandleSqrt extends HandleEvent {
    public HandleSqrt(CalculatorWindows window) {
        super(window);
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        String mess = "\n√" + window.computer.getResult() + "= ";
        window.computer.initDataItemByMath(new Sqrt());
        mess += window.computer.getTempResult();

        window.saveComputerProcess.append(mess);

        window.computer.tempResult.pop();
        window.computer.result = 0;
    }
}
